﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Office;

namespace UnitTestProject1
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {

            Excel excel = new Excel();
            excel.OpenExcel(@"d:\test.xlsx");


            Assert.AreEqual(1.0d,excel.GetData("A1",null));
            Assert.AreEqual(1.0d, excel.GetData("A2", null));

            Excel.CloseAllExcel();


        }

        [TestMethod]
        public void TestMethod2()
        {

            ExcelRPosition R = new ExcelRPosition();

            //R.NextCloumns(26);
            //Assert.AreEqual("Z", R.CurrentColumn);

            //R.NextCloumns(27);
            //Assert.AreEqual("AA", R.CurrentColumn);

            R.NextCloumns(26 * 26+26);
            Assert.AreEqual("AAA", R.CurrentColumn);

            R.CurrentColumn = "AAA";
            Assert.AreEqual("AAA", R.CurrentColumn);

        }



        [TestMethod]
        public void TestMethod3()
        {

            ExcelSingle excel1 = new ExcelSingle();
            ExcelSingle excel2 = new ExcelSingle();

            excel2.OpenExcel("D:\\2.xls");

            excel1.OpenExcel("d:\\1.xlsx");

            excel1.GetData("A1", null);

            excel1.CloseExcel(false);

            Excel.CloseAllExcel();

            

          

        }

    }
}
